/* Copyright 2007-2008 dnAnalytics Project.
 *
 * Contributors to this file:
 * Patrick van der Velde
 *
 * This file is part of dnAnalytics.  dnAnalytics is licensed under the 
 * Microsoft Public License. See License.txt for a complete copy of the
 * license.
 */

using dnAnalytics.LinearAlgebra;
using System.ComponentModel;
using System.Diagnostics;

namespace dnAnalytics.DebugVisualizers
{
    /// <summary>
    /// Defines the base interface for classes that store vector properties
    /// for use in a <c>PropertyGrid</c>.
    /// </summary>
    public abstract class VectorProperties
    {
        /// <summary>
        /// Returns the vector.
        /// </summary>
        [Browsable(false)]
        protected abstract Vector Vector
        {
            get;
        }

        /// <summary>
        /// Returns the name of the vector.
        /// </summary>
        [Category("General information")]
        [DisplayName("Name")]
        [Description("The type of vector being displayed.")]
        public string Name
        {
            [DebuggerStepThrough]
            get
            {
                return Vector.GetType().Name;
            }
        }

        /// <summary>
        /// Returns the number of elements in the vector.
        /// </summary>
        [Category("Dimensions")]
        [DisplayName("Number of elements")]
        [Description("The number of elements in the vector.")]
        public int Count
        {
            [DebuggerStepThrough]
            get
            {
                return Vector.Count;
            }
        }
        
        /// <summary>
        /// Returns the value at the specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <returns>The requested value.</returns>
        public double Item(int index)
        {
            return Vector[index];
        }
    }
}